using System;
using System.Collections;

using VCDepend.Engine;

namespace VCDepend.Tests.Stubs
{
	public class StubDependencySource : IDependencySource
	{
		private Hashtable m_dependencies;

		public StubDependencySource()
		{
			m_dependencies = new Hashtable();
		}

		public string[] GetDependencyNames(Project project)
		{
			return StringArrayMaker.ToArray(GetDependencyList(project.Name));
		}

		public void AddDependency(string name, string dependency)
		{
			ArrayList dependencyList = GetDependencyList(name);
			dependencyList.Add(dependency);
		}

		private ArrayList GetDependencyList(string name)
		{
			if (m_dependencies[name] == null)
				m_dependencies[name] = new ArrayList();

			return (ArrayList)m_dependencies[name];
		}
	}
}
